// components/pageBg/index.js
Component({
  options:{
    multipleSlots:true
  },
  /**
   * 组件的属性列表
   */
  properties: {
    navType:{
      type:String,
      value:'description'
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    description(){
      // wx.redirectTo({
      //   url: '../../pages/rules/index'
      // })
      const url = this.getPageUrl()
      if(url!=='pages/rules/index'){
        // wx.reLaunch({
        //   url: '../../pages/rules/index'
        // })
        wx.reLaunch({
          url: '../../pages/rules/index'
        })
      }
    },
    introduction(){
      // wx.redirectTo({
      //   url: '../../pages/schedule/index'
      // })
      const url = this.getPageUrl()
      if(url!=='pages/schedule/index'){
        wx.reLaunch({
          url: '../../pages/schedule/index'
        })
      }
    },
    brightSpot(){
      // wx.redirectTo({
      //   url: '../../pages/brightSpot/index'
      // })
      const url = this.getPageUrl()
      if(url!=='pages/brightSpot/index'){
        wx.reLaunch({
          url: '../../pages/brightSpot/index'
        })
      }
    },
    getPageUrl(){
      var pages = getCurrentPages()    //获取加载的页面
      var currentPage = pages[pages.length-1]    //获取当前页面的对象
      var url = currentPage.route    //当前页面url
      return url
    }
  }
})
